package com.itheima.service.impl;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.apache.dubbo.config.annotation.Service;


import java.util.Random;


@Service
public class UserServiceImpl implements UserService {

    private Random random=new Random();

    public String sayHello() {
        try {
            int time = random.nextInt(4000);
            System.out.println("本次访问时间："+time);

            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return "hello dubbo!~~~~~~~~~~~~~~~";
    }

    @Override
    public User findById(Integer id) {
        User user=new User();
        user.setName("张益达"+id);
        user.setAge(id);
        return user;
    }
}
